사이트 내 전체검색
[서버관리] 웹호스팅 하나에서 여러개의 홈페이지 운영할때 .htaccess / 웹호스팅 1개로 사이트 2개 만들기
하우코드
https://cmd.kr/server/1131 URL이 복사되었습니다.

본문

esi.kr 은 /esi/ 폴더에 홈페이지가 있고,
howcode.co.kr 은 /main/ 폴더에 홈페이지가 있을떼

/.htaccess 에 다음과 같이 넣는다.
<ifmodule mod_rewrite.c>
RewriteEngine on

RewriteCond %{HTTP_HOST} ^(esi\.kr|essy\.kr)
RewriteRule (.*) https://esi.kr/esi/$1 [L]

RewriteCond %{HTTP_HOST} ^(howcode\.co\.kr)
RewriteRule (.*) https://howcode.co.kr/main/$1 [L]
</ifmodule>

메인 index.php 에는

<?php
//var_dump($_SERVER);
if (stristr('esi.kr',$_SERVER['SERVER_NAME'])||stristr('essy.kr',$_SERVER['SERVER_NAME'])) {
echo "<script>document.location='https://esi.kr/esi/';</script>";
exit;
}
?>
<script>document.location='https://howcode.co.kr/main/'</script>

댓글목록

등록된 댓글이 없습니다.

1,139 (1/23P)

Search

Copyright © Cmd 명령어 3.129.19.251